package com.software.project.repository;

import com.software.project.entity.Weapon;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface WeaponRepository extends JpaRepository<Weapon, Integer>, JpaSpecificationExecutor {

    // 查询出已拥有和可解锁的武器
    List<Weapon> findByWeaponRequireIntelligenceLessThanEqualAndWeaponRequirePowerLessThanEqual(int intelligence, int power);
    //查询出不可解锁的武器
    List<Weapon> findByWeaponRequireIntelligenceGreaterThanOrWeaponRequirePowerGreaterThan(int intelligence, int power);
    //根据武器图片路径查找武器对象
    Optional<Weapon> findByWeaponSrc(String weaponImage);
}